package com.avalon.shop.controller;


import com.avalon.shop.service.ResourceService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/resource")
public class ResourceController {
    private final ResourceService resourceService;

    public ResourceController(ResourceService resourceService) {
        this.resourceService = resourceService;
    }

    @PostMapping("/banner/get")
    public List<Map> getBannerResource() {
        return resourceService.getResourceAll("carousel");
    }

    @PostMapping("/activity/get")
    public List<Map> getActivityResource() {
        return resourceService.getResourceAll("activity");
    }

    @PostMapping("/order/get")
    public List<Map> getOrderResource() {
        return resourceService.getResourceAll("orderState");
    }

    @PostMapping("/meBg/get")
    public List<Map> getBgResource() {
        return resourceService.getResourceAll("meBg");
    }

    @PostMapping("/share/get")
    public List<Map> getShareResource() {
        return resourceService.getResourceAll("share");
    }
}
